
package com.xb.loan.usercenter.service.user;


import com.xb.loan.log.exception.BizException;
import com.xb.loan.usercenter.service.user.bean.WinstantLoginInfoVO;
import com.xb.loan.usercenter.service.user.bean.WinstantOnlineUserVO;
import com.xb.loan.usercenter.service.user.bean.WinstantUserSessionIdBakVO;

public interface IWinstantSessionService {

	/**
	 * 退出登录时，清除session会话
	 * @param sessionId
	 * @return
	 * @throws BizException
	 */
	public boolean clearUserInfoCache(String sessionId) throws BizException;
	
	/**
	 * 依据sessionId查询缓存中用户登录信息
	 * @param sessionId
	 * @return
	 * @throws BizException
	 */
	public WinstantLoginInfoVO queryUserInfoCacheOnly(String sessionId) throws BizException;
	
	/**
	 * 依据sessionId查询缓存中用户登录信息，这个方法有检查登录的功能，主要给前端http调用。
	 * @param sessionId
	 * @return
	 * @throws BizException
	 */
	public WinstantLoginInfoVO queryUserInfoCache(String sessionId) throws BizException;
	
	/**
	 * 新增缓存中的用户登录信息,会同时存入UserInfo和UserSessionIdBak,这个主要给前端http调用。
	 * @param loginInfoVO
	 * @return
	 * @throws BizException
	 */
	public String insertUserInfoCache(WinstantLoginInfoVO loginInfoVO) throws BizException;
	
	/**
	 * 只缓存UserInfo信息
	 * @param loginInfoVO
	 * @return
	 * @throws BizException
	 */
	public String insertUserInfoCacheOnly(WinstantLoginInfoVO loginInfoVO) throws BizException;
	
	/**
	 * 更新缓存中的用户登录信息
	 * @param loginInfoVO
	 * @return
	 * @throws BizException
	 */
	public boolean updateUserInfoCache(WinstantLoginInfoVO loginInfoVO) throws BizException;
	
	/**
	 * 生成sessionId
	 * @param loginInfoVO
	 * @return
	 * @throws BizException
	 */
	public String generateSessionId(WinstantLoginInfoVO loginInfoVO) throws BizException;
	
	/**
	 * 依据用户Id查询对应的老的sessionId
	 * @param userId
	 * @return
	 * @throws BizException
	 */
	public WinstantUserSessionIdBakVO queryUserSessionIdBakVO(String userId) throws BizException;
	
	/**
	 * 新增
	 * @param userSessionIdBakVO
	 * @return
	 * @throws BizException
	 */
	public boolean insertUserSessionIdBakVO(WinstantUserSessionIdBakVO userSessionIdBakVO) throws BizException;
	
	/**
	 * 更新
	 * @param userSessionIdBakVO
	 * @return
	 * @throws BizException
	 */
	public boolean updatetUserSessionIdBakVO(WinstantUserSessionIdBakVO userSessionIdBakVO) throws BizException;
	
	/**
	 * 清除
	 * @param userId
	 * @return
	 * @throws BizException
	 */
	public boolean clearUserSessionIdBakVO(String userId) throws BizException;
	
	/**
	 * 查询完全注册用户数和部分注册用户数
	 * @return
	 * @throws BizException
	 */
	public WinstantOnlineUserVO queryOnlineUserVO() throws BizException;
	
	/**
	 * 新增
	 * @param onlineUserVO
	 * @return
	 * @throws BizException
	 */
	public boolean insertOnlineUserVO(WinstantOnlineUserVO onlineUserVO) throws BizException;
	
	/**
	 * 更新
	 * @param onlineUserVO
	 * @return
	 * @throws BizException
	 */
	public boolean updateOnlineUserVO(WinstantOnlineUserVO onlineUserVO) throws BizException;
	
	/**
	 * 清除
	 * @return
	 * @throws BizException
	 */
	public boolean clearOnlineUserVO() throws BizException;
	
	/**
	 * 同步更新在线用户数量
	 * @return
	 * @throws BizException
	 */
	public boolean synUpdateOnlineUserVO(int realFlag, int updateNum) throws BizException;
	
}
